import type { RouteRecordRaw } from 'vue-router'
// import staticRoutes from '@/router/static'

// 需要授权的路由
const checkRoutes: Array<RouteRecordRaw> = []
const staticFiles: Record<string, Record<string, RouteRecordRaw>> = import.meta.glob(
  './crud/*.ts',
  { eager: true }
)
for (const key in staticFiles) {
  if (staticFiles[key].default) checkRoutes.push(staticFiles[key].default)
}

checkRoutes.sort((a, b) => {
  const weightA = Number(a.meta?.weight ?? 0)
  const weightB = Number(b.meta?.weight ?? 0)
  return weightA - weightB
})

export default checkRoutes
